package com.ys.service.finance.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSON;
import com.ys.dto.AddDto;
import com.ys.dto.EditDto;
import com.ys.entity.finance.TbPointRunningItem;
import com.ys.mapper.finance.TbPointRunningItemMapper;
import com.ys.service.finance.TbPointRunningItemService;
import com.ys.vo.R;

@Service("tbPointRunningItemService")
public class TbPointRunningItemServiceImpl implements TbPointRunningItemService {

	@Autowired
	private TbPointRunningItemMapper tbPointRunningItemMapper;

	@Override
	public R deleteFalse(Long id) {
		
		tbPointRunningItemMapper.deleteTrue(id);
		return R.ok();
	}

	@Override
	public R add(Map<String, Object> params) {
		
		TbPointRunningItem entity = JSON.parseObject(JSON.toJSONString(params), TbPointRunningItem.class);
		
		tbPointRunningItemMapper.insert(entity);
		
		return R.ok(AddDto.closeAndReload());
	}

	@Override
	public R edit(Map<String, Object> params) {

		
		TbPointRunningItem entity = JSON.parseObject(JSON.toJSONString(params), TbPointRunningItem.class);
		
		tbPointRunningItemMapper.update(entity);
		
		return R.ok(EditDto.closeAndReload());
	}
}
	

